package com.kaibes.core.base.option;

import java.util.function.BooleanSupplier;
import java.util.function.Supplier;

public class BooleanOptions {

    public static void ifTrue(boolean flag, Runnable run) {
        if (flag) {
            run.run();
        }
    }
    
    //===
    public static <T> T returnObject(boolean flag, Supplier<T> supplier) {
        return flag?supplier.get():null;
    }
    public static boolean returnFalse(boolean flag, BooleanSupplier supplier) {
        return flag?supplier.getAsBoolean():false;
    }
    public static boolean returnTrue(boolean flag, BooleanSupplier supplier) {
        return flag?supplier.getAsBoolean():true;
    }
}
